package router

import (
	"github.com/gin-gonic/gin"
	"go-graduation/bff/internal/biz"
	"google.golang.org/grpc"
)

type V1Router struct {
	conn  *grpc.ClientConn
	engin *gin.Engine
}

func NewV1Router(conn *grpc.ClientConn, engin *gin.Engine) *V1Router {
	return &V1Router{
		conn:  conn,
		engin: engin,
	}
}

func (a *V1Router) AddRouter() {

	// v1版本路由
	v1 := a.engin.Group("/v1")
	{
		// 新增控制器请在这里加
		v1.GET("/article/list", biz.NewArticle(a.conn).GetArticleByPage)
		v1.GET("/article/detail", biz.NewArticle(a.conn).GetOneArticleById)
		v1.GET("/article/comment/add", biz.NewArticleComment(a.conn).AddComment)
	}
}
